package cn.tx.controller;

import java.util.List;

import cn.tx.model.OrderDetail;
import cn.tx.query.OrderDetailQuery;
import cn.tx.service.OrderDetailService;
import cn.tx.util.Page;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ModelDriven;

public class OrderDetailAction extends BaseAction implements ModelDriven<OrderDetail>{
	
	private OrderDetail orderDetail = new OrderDetail();
	
	private OrderDetailService orderDetailService;
	
	
	
	
	public OrderDetail getOrderDetail() {
		return orderDetail;
	}

	public void setOrderDetail(OrderDetail orderDetail) {
		this.orderDetail = orderDetail;
	}

	/**
	 * 查询对象
	 */
	private OrderDetailQuery erpQuery = new OrderDetailQuery();
	
	
	public OrderDetailService getOrderDetailService() {
		return orderDetailService;
	}

	public void setOrderDetailService(OrderDetailService orderDetailService) {
		this.orderDetailService = orderDetailService;
	}
	

	public OrderDetailQuery getErpQuery() {
		return erpQuery;
	}

	public void setErpQuery(OrderDetailQuery erpQuery) {
		this.erpQuery = erpQuery;
	}

	/**
	 * 查询员工的列表
	 * @return
	 */
	public String orderDetail_detaillist(){
		//获得action的容器
		ActionContext context = ActionContext.getContext();
		Page page = orderDetailService.selectObjectByConditionPage(erpQuery, exclude);
		context.put("page", page);
		
		return SUCCESS;
	}
	
	/**
	 * 跳转到添加页面
	 * @return
	 */
	public String orderDetail_input(){
		
		return SUCCESS;
	}
	/**
	 * 跳转到修改页面
	 * @return
	 */
	public String orderDetail_preupdate(){
		orderDetail = orderDetailService.getObjectById(orderDetail.getOrderDetailId());
		return SUCCESS;
	}
	/**
	 * 保存
	 * @return
	 */
	public String orderDetail_save(){
		orderDetailService.save(orderDetail);
		return TOLIST;
	}
	/**
	 * 修改
	 * @return
	 */
	public String orderDetail_update(){
		orderDetailService.update(orderDetail);
		return TOLIST;
	}
	/**
	 * 修改
	 * @return
	 */
	public String orderDetail_delete(){
		orderDetail = orderDetailService.getObjectById(orderDetail.getOrderDetailId());
		orderDetailService.delete(orderDetail);
		return TOLIST;
	}

	@Override
	public OrderDetail getModel() {
		return orderDetail;
	}
	
	
	
	

}
